package com.sunyard.pcc.core.manager.impl;

import com.sunyard.michiru.common.entity.PageResult;
import com.sunyard.pcc.dal.model.SysUserRoleDO;
import com.sunyard.pcc.dal.query.SysUserRoleQuery;
import com.sunyard.pcc.dal.mapper.ext.SysUserRoleExtMapper;
import com.sunyard.pcc.core.manager.SysUserRoleManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Manager for SysUserRole.
 */
@Component
public class SysUserRoleManagerImpl implements SysUserRoleManager{

    
    @Autowired
    protected SysUserRoleExtMapper sysUserRoleExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(SysUserRoleQuery query){
        return sysUserRoleExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(SysUserRoleQuery query){
        return sysUserRoleExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(SysUserRoleDO record){
        return sysUserRoleExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(SysUserRoleDO record){
        return sysUserRoleExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<SysUserRoleDO> selectByQuery(SysUserRoleQuery query){
        return sysUserRoleExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<SysUserRoleDO> selectByQueryWithPage(SysUserRoleQuery query) {
        PageResult<SysUserRoleDO> result = new PageResult<SysUserRoleDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public SysUserRoleDO selectByPrimaryKey(Long id){
        return sysUserRoleExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( SysUserRoleDO record,  SysUserRoleQuery query){
        return sysUserRoleExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( SysUserRoleDO record,  SysUserRoleQuery query){

        return sysUserRoleExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(SysUserRoleDO record){
        return sysUserRoleExtMapper.updateByPrimaryKeySelective(record);
    }

}